﻿using StarsAdmin.Core.Models;

namespace StarsAdmin.Core.DB.Entities
{
    /// <summary>
    /// Api接口实体
    /// </summary>
    public class ApiEntity : BaseEntity, ITree<ApiEntity>
    {
        /// <summary>
        /// 接口名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 接口注释标签
        /// </summary>
        public string? Label { get; set; }

        /// <summary>
        /// 接口地址
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// 接口提交方法
        /// </summary>
        public string? HttpMethod { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; } = 1;

        /// <summary>
        /// 启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 所属模块
        /// </summary>
        public long? ParentId { get; set; }

        /// <summary>
        /// 所属模块
        /// </summary>
        public virtual ApiEntity Parent { get; set; }

        /// <summary>
        /// 下一级菜单集合
        /// </summary>
        public virtual ICollection<ApiEntity> Children { get; set; } = new List<ApiEntity>();

        public long[]? MenuIds { get; set; }
        public virtual ICollection<MenuEntity> Menus { get; set; } = new List<MenuEntity>();
    }
}